{extend name="index/base" /}
{block name="style"}{/block}
{block name="body"}
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">通知配置</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
        <div class="layui-tab-item layui-show">
            <fieldset class="layui-elem-field">
                <legend>广告管理 - 通知配置</legend>
                <div class="layui-field-box">
                    <form class="layui-form" action="{:url('push/sendByAll')}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">自动弹出：</label>
                            <div class="layui-inline" style="width: 200px;">
                                <select class="layui-input"  name="is_auto_popup">
                                    <option value="1">开启</option>
                                    <option value="0">关闭</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">弹出图片:</label>
                            <div class="appheadimg layui-inline">
                                {eq name='config.ad_bulletin_img' value="0"}
                                <img src="__IMG__/0.jpg" width="300" />
                                {else/}
                                <img src="{$img}"  style="max-width: 300px;max-height: 150px;" />
                                {/eq}
                                <input type="hidden" name="img" value="" id="iptiab">
                            </div>
                            <button type="button" class="layui-btn layui-btn-small" id="ad_bulletin_img">
                                <i class="layui-icon">&#xe67c;</i>上传图片
                            </button>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button  class="layui-btn" lay-submit="" lay-filter="ajax-post" type="submit" target-form="layui-form">保存</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
        </div>
    </div>
</div>

{/block}


{block name="script"}
<script type="text/javascript">
    layui.use(['tool','element','upload'],function(){
        var $ = layui.jquery,layer = layui.layer,form = layui.form,tool = layui.tool,element = layui.element,upload = layui.upload;
        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function(elem){
            location.hash = 'test='+ $(this).attr('lay-id');
        });
        //上传图片-app图
        var uploadInst = upload.render({
            elem: '#ad_bulletin_img' //绑定元素
            ,url: '{:url('Ajax/upload')}' //上传接口
            ,done: function(res){
            //上传完毕回调
            if (res.code==1) {
                $('#iptiab').val(res.data.url);
                $('.appheadimg img').attr('src',res.data.url);
            }else{
                layer.msg(res.data,{icon:2});
            }
        }
    ,error: function(){
            //请求异常回调
            layer.msg('上传异常~');
        }
    });

        tool.setValue('config[invite_need_code]','{$config.invite_need_code}');
        tool.setValue('lvcfg[order_jiesuan_type]','{$lvcfg.order_jiesuan_type}');
    });
</script>
{/block}